import React, { Component } from 'react'
import { observer, inject } from 'mobx-react'
import {
  View,
  Text,
  Button,
} from 'react-native'

@inject('test1Store')
@observer
export default class test1 extends Component {

  render() {
    console.log('test1 render')
    return (
      <View style={{ justifyContent: 'center', alignItems: 'center', }}>
        <Text style={{ marginBottom: 15, fontSize: 16, }}>Count = {this.props.test1Store.count}</Text>
        <Button
          onPress={() => {
            this.props.test1Store.addCount(parseInt(Math.random() * 10))
          }}
          title={'随机变化'}
        />
        <Button
          onPress={() => {
            this.props.test1Store.reset()
          }}
          title={'初始化数据'}
        />
      </View>
    )
  }
}